package dao;


import essenceClasses.CurrentTask;
import interfaceDao.ICurrentTaskDao;
import model.CurrentTaskModel;
import model.TaskState;

import java.sql.SQLException;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: user
 * Date: 25.05.14
 * Time: 12:22
 * To change this template use File | Settings | File Templates.
 */
public class CurrentTaskDao implements ICurrentTaskDao {

    private CurrentTaskModel currentTaskModel;

    public CurrentTaskDao() {
        this.currentTaskModel = new CurrentTaskModel();
    }

    @Override
    public boolean addCurrentTask(int taskID, int creatorID, String status, int recepientID) {
        return currentTaskModel.addCurrentTask(taskID, creatorID, status, recepientID);  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public List<CurrentTask> getCurrentTasksById(int taskID) throws SQLException {
        return currentTaskModel.getCurrentTasksById(taskID);  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public List<CurrentTask> getCurrentTasksByCreatorId(int id) throws SQLException {
        return currentTaskModel.getCurrentTasksByCreatorId(id);  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public List<CurrentTask> getCurrentTasksByRecepientId(int id) throws SQLException {
        return currentTaskModel.getCurrentTasksByRecepientId(id);  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public boolean deleteCurrentTaskById(int id) throws SQLException {
        return currentTaskModel.deleteCurrentTaskById(id);  //To change body of implemented methods use File | Settings | File Templates.
    }


    @Override
    public boolean changeStateCurrentTaskById(int id, int state) throws SQLException {
        return currentTaskModel.changeStateCurrentTaskById(id, state);  //To change body of implemented methods use File | Settings | File Templates.
    }

    public List<CurrentTask> getCurrentTaskByState(TaskState ts)throws SQLException{
        return currentTaskModel.getCurrentTaskByState(ts);
    }
}
